package com.booza.dao;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import com.booza.model.Account;


/**
 * The DAO level interface for user account management.
 * 
 * @see AccountServiceImpl
 */
public interface AccountDAO
{
	/**
	 * Creates user account.Saves the details in account table.
	 * 
	 * @param account
	 *          -encapsulated user details
	 */
	void createAccount(Account account);

	/**
	 * Search and return user account
	 * 
	 * @param id
	 *          - unique identifier of the user in account table
	 * @return
	 */
	Account findAccountById(Integer id);

	/**
	 * Searches the user account by email.
	 * 
	 * @param email
	 *          - email id to search
	 * @return Returns the matching account.
	 */
	Account findAccountByEmail(String email);

	/**
	 * Searches the user account by <code>username</code>.
	 * 
	 * @param username
	 *          - userid to search
	 * @return Returns the matching user account.
	 */
	Account findAccountByUserId(String username);

	/**
	 * Fetch user accounts matching the criteria specified.
	 * 
	 * @param likeColumns
	 *          - map of columname, keyword
	 * @return Returns matching users list.
	 */
	List<Account> fetchAccounts(Map<String, String> likeColumns);

	/**
	 * Fetch all user accounts in table.
	 * 
	 * @return Returns a list of all users registered.
	 */
	List<Account> fetchAll();

	/**
	 * Updates user account details.
	 * 
	 * @param account
	 *          -details to updated
	 */
	void updateAccount(Account account);

	/**
	 * Searches for the confirmation code.
	 * 
	 * @param id
	 *          -confirmation code to search.Supposed to be unique
	 * @return Return user account details matching the confirmation code.
	 */
	Account checkConfirmationCode(String id);

	/**
	 * Search user accounts matching the criteria.
	 * 
	 * @param username
	 *          - userid to search for
	 * @param firstname
	 *          -firstname to search for
	 * @param lastname
	 *          -lastname to search for
	 * @return mathcing user list
	 */
	Collection<Account> searchAccounts(String username);

	/**
	 * Finds list of users with rankings/points greater than 800. Daily deductions will be applied to these users.
	 * 
	 * @return
	 */
	Collection<Account> getRankingsForDailyDeductions();
}
